package logic.collegeQuery_logic;

import java.util.LinkedList;
import java.util.List;
import po.CollegeStudentListPO;
import po.StudentPO;
import po.TeacherPO;
import resultmessage.CollegeQueryRM;
import vo.StudentVO;
import vo.TeacherVO;
import datasv.collegeQuery_datasv.CollegeQueryDatasv;
import datasv.datafactorysv.CollegeQueryDatasvFactory;

public class MemberQuery implements MemberQuerysv {
	private CollegeQueryDatasv collegeQD;
	
	public MemberQuery(){
		// TODO Auto-generated method stub
		collegeQD = new CollegeQueryDatasvFactory().create();
	}

	@Override
	public CollegeQueryRM addStudent(String collegeID, StudentPO student) {
		// TODO Auto-generated method stub
		return collegeQD.addStudent(collegeID, student);
	}

	@Override
	public CollegeQueryRM deleteStudent(String collegeID, String studentID) {
		// TODO Auto-generated method stub
		return collegeQD.deleteStudent(collegeID, studentID);
	}

	@Override
	public CollegeQueryRM addTeacher(String collegeID, TeacherPO teacher) {
		// TODO Auto-generated method stub
		return collegeQD.addTeacher(collegeID, teacher);
	}

	@Override
	public CollegeQueryRM deleteTeacher(String collegeID, String teacherID) {
		// TODO Auto-generated method stub
		return collegeQD.deleteTeacher(collegeID, teacherID);
	}

	@Override
	public List<StudentVO> getCollegeSudents(String collegeID) {
		CollegeStudentListPO students = collegeQD.getCollegeStudents(collegeID);
		LinkedList<StudentVO> list = new LinkedList<StudentVO>();
		for(String id : students.getStudentList()){
			list.add(new StudentVO(id));
		}
		return list;
	}

	@Override
	public List<TeacherVO> getCollegeTeachers(String collegeID) {
		// TODO Auto-generated method stub
		CollegeStudentListPO teachers = collegeQD.getCollegeStudents(collegeID);
		LinkedList<TeacherVO> list = new LinkedList<TeacherVO>();
		for(String id : teachers.getStudentList()){
			list.add(new TeacherVO(id));
		}
		return list;
	}

}
